package com.demo.service.blank;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;

/**
 * 转入
 * @author K
 */
@Slf4j
@Component(value = "transferInDelegate")
public class TransferInDelegate implements JavaDelegate {
    @Override
    public void execute(DelegateExecution execution) {
        Integer output = execution.getVariable("output", Integer.class);
        Boolean flag = execution.getVariable("flag", Boolean.class);

        if (flag) {
            log.info("转入银行---增加金额:{}", output);
            execution.setVariable("input", output);
        } else {
            int input = output - 1;
            execution.setVariable("input", input);
            log.info("转入银行---增加金额:{}", input);
        }
    }
}
